<% displayed_attribute_name = displayed_attribute_name || attribute_name.titleize.pluralize %>
<h4><%= h displayed_attribute_name %>
<% if logged_in? %>
  <%= link_to_function("[+]", visual_effect(:toggle_slide,
      "add_" + annotatable.class.name.downcase + "_" + attribute_name + 
      annotatable.id.to_s, :duration => 0.3), :class => "active", :style => "") -%>
<% else %>
  <% session[:original_uri] = request.request_uri %>
  <%= link_to ("[+]"), :controller => "home", :action => "login" %>
<% end %>
</h4>
<% annotations = annotatable.annotations_with_attribute(attribute_name) %>
<% unless annotations.empty?  %>
  <% annotations.each do |ann| %>
    <div class="<%= attribute_name -%>">
      <span style="float: left;">
        <%= case attribute_name 
             when "category": h(Category.find_by_id(ann.value).name)
             when "example_workflow": link_to h(ann.value), ann.value, :target => "blank" 
             else CGI::escapeElement(ann.value, "script")
           end -%>        
      </span>
      <span style="float: right;">
        <i><%=h ann.source.name -%></i>
        <%= link_to '[x]', ann, :confirm => 'Are you sure you want to delete this annotation?  This cannot be undone.', 
            :method => :delete if logged_in? && ann.source==current_user -%>  
      </span><br/>
    </div>  
  <% end %>
<% else %>
  <div class="no_annotations">
    <i>none</i>
  </div>  
<% end %>

<%= render :partial => 'annotations/annotation_form', 
    :locals => {:attribute_name => attribute_name, 
        :annotatable_type => annotatable.class.name, 
        :annotatable_id => annotatable.id} %>